Unit 3 Exercise 13
Exercise 13: Events
Objective
To use Events to cancel a job in a workflow when a preceding job finishes okay.
Summary
Utilizing your MY FIRST SCHEDULE, you will add 3 new jobs. The first job will Finish OK and will trigger an $JOB:CANCEL event to cancel the third job. All the jobs will run the GenericP program and should run 7 days a week.
These jobs should run in a particular order so that the event will cancel the third job.
Run Order: Test Event 1 → Test Event 2 → Test Event 3.
Instructions
Create the Jobs
- In Library > Administration, double click on Master Jobs.
- On the Master Job list, click Add.
- In the Schedule dropbox, select My First Schedule.
- In the Name field, enter in Test Event 1.
- In the Job Type drop-down list, select Windows.
- In the Machine Selection drop-down list, select the SMATraining machine for the Job to run on.
- In the User ID drop-down list, select
SMATRAINING\SMAUSER
- In the Command Line, using the Magic Wand or CRTL+Space, create the following command:
"[[Path_Windows]]\genericp.exe" -t[[Runtime]]
- Click the Save button.
- Click the Lock button in the upper right-hand corner.
- Expand the Frequency box.
- Add a frequency for a Mon-Sun-O pattern.
- In the Frequency Name box, type Mon-Sun-O.
- Set When to Schedule as All Weeks.
- Select all days of the week by marking their check boxes.
- Be sure that the A/O/B/N radio button is set to On Date.
- Click the Save button.
- Click the Back button to return to the Job List.
- Using the filters at the top of the Job List, locate Test Event 1 Job and Copy it twice, once for Test Event 2 and once for Test Event 3.
Create the Event
- Using the filters at the top of the Job List, locate and select Test Event 1.
- Click Edit.
- Click the Lock icon to enter Admin Mode.
- Locate and expand the Events section.
- Click the + button.
- In the Create new Event screen:
- In the Send Event On dropdown, select Job Status.
- In the Job Status dropdown, select Finished OK.
- In the Event Template dropdown, select the $JOB:CANCEL event.
- In the Schedule Date field, use the Magic Wand or CTRL+SPACE to enter in $SCHEDULE DATE.
- In the Schedule Name field, use the Magic Wand or CTRL+SPACE to enter in $SCHEDULE NAME.
- In the Job Name field, enter in the job name for Test Event 3.
- Click Save.
- Click Save.
- Close Library.
info
For all events, you can use System Properties for fields like the Schedule Date and Schedule Name.
- For example: To use a
$JOB:CANCEL,<Schedule date>,<Schedule name>,<Job name>
event, you can substitute the following for the appropriate fields:<Schedule date>
can be replaced with eitherCURRENT
,[[$DATE]]
, or[[$SCHEDULE DATE]]
<Schedule name>
needs to be replaced with either the full name of the Schedule the Job is in or[[$SCHEDULE NAME]]
<Job name>
needs to be replaced with the name of the Job this Event is going to cancel
Add Dependencies
- Open Studio.
- Select My First Schedule.
- Click View.
- Click Test Event 3.
- In the side menu, select Add Dependency.
- In the Job Dependency pop-up, select Test Event 2 in the Job drop down list.
- Verify that the Dependency Type is Requires and the Condition is Finished OK.
- Click the Save button.
- Repeat Steps 26-30 to add a dependency between Test Event 1 and Test Event 2.
- Close Studio.
Rebuild the Schedule
- In Operations, select Schedule Build.
- In the Schedule Date section, validate that today's date is specified for both From and To.
- In the Schedule Build section, click the Released radio button.
- Toggle on Overwrite Existing Schedules.
- In the Schedule Selection list, select My First Schedule.
- Click the Build button.
- Expand and click on the schedule link for My First Schedule to return to the Processes screen.
Enterprise Manager
Details
- Create the Schedules/Jobs
- Under the Administration topic, Double-Click on Job Master.
- In the Schedule drop-down list, select My First Schedule.
- On the Job Master Toolbar, click the Add button.
- In the Name textbox, enter Test Event 1.
- In the Job Type drop-down list, select Windows.
- In the Primary Machine drop-down list, select the SMATraining machine for the Job to run on.
- In the User ID drop-down list, select
SMATRAINING\SMAUSER
- In the Command Line, type Ctrl + F and Double-Click on the command that looks like this:
“[[PathWindows]]\genericp.exe” –t[[RUNTIME]]
- Click the Save button.
- Click the Frequency tab.
- Within the Frequency list frame, click the Add button.
- Click inside the option button to Use existing Frequency.
- In the Frequency drop-down list, select Mon-Sun-O.
- Click Next.
- Click the Finish button.
- On the Job Master Toolbar, click the Copy button.
- Name the Job Test Event 2.
- Click OK.
- On the Job Master Toolbar, click the Copy button.
- Name the Job Test Event 3.
- Click OK.
- Click the Frequency tab.
- In the Job Build Status frame, select On Hold.
- Click the Save button.
- Close the Job Master.
- Under the Administration topic, Double-Click on Workflow Designer.
- In the Select Schedule list, select My First Schedule.
- Click the Add Dependency tool.
- Click Test Event 1, then Test Event 2 to create a Requires dependency.
- Click Test Event 2, then Test Event 3 to create a Requires dependency.
- Create the Events
- From the Workflow Designer, Right-Click Test Event 1 and select Edit.
- Click on the Events tab.
- In the Events frame, click the Add button.
- In the Event Definition Wizard, under Send Event on select the option button for Job Status.
- Click the Next button.
- In the Job Status drop-down list, select Finished OK.
- Click the Next button.
- In the Event Template drop-down list, select the
$JOB:CANCEL Event
.
Example:
$JOB:CANCEL,<Schedule date>,<Schedule name>,<Job name>
<Schedule date>
needs to be replaced with eitherCURRENT
,[[$DATE]]
, or[[$SCHEDULE DATE]]
<Schedule name>
needs to be replaced with either the full name of the Schedule the Job is in, or[[$SCHEDULE NAME]]
<Job name>
needs to be replaced with the name of the Job this Event is going to cancel- Your Event should look like this:
[[$SCHEDULE DATE]],[[$SCHEDULE NAME]],Test Event 3
- Click the Finish button.
- Close the Job Master and the Workflow Designer tabs.
- Open one of the operations views and check if My First Schedule is In Process note
Cancel the Jobs if My First Schedule is not Completed
- Build the Schedule (Released) and watch it process.
- Use either List or Matrix views in Enterprise Manager or use Solution Manager.